# 首先安装mysql
FROM php:7.3-fpm

# 标签
LABEL MAINTAINER="This is PHP container!"\
    name="PHP7.3FPM" \
    build-data="2021/8/30"
# 设置时区
ENV TIMEZONE Asia/Shanghai
#apt-get源
RUN sed -i s/deb.debian.org/mirrors.aliyun.com/g /etc/apt/sources.list
# 复制扩展安装包
COPY ./ext/ /root/ext/
# 安装composer
COPY --from=composer /usr/bin/composer /usr/bin/composer

# 安装依赖,核心扩展,pecl扩展,git,composer,npm工具
RUN apt update && apt install -y \
    # GD库依赖
    libwebp-dev \
    libjpeg-dev \
    libpng-dev \
    libfreetype6-dev \
    libzip-dev \ 
    # 增加ps命令
    procps \
    # event扩展需要
    libevent-dev
# 解压源码
RUN docker-php-source extract \
    # 移动到GD目录
    && cd /usr/src/php/ext/gd \
    #准备编译
RUN docker-php-ext-configure gd --with-webp-dir=/usr/include/webp --with-jpeg-dir=/usr/include --with-png-dir=/usr/include --with-freetype-dir=/usr/include/freetype2 && cd -
# 扩展安装
RUN docker-php-ext-install gd \
    pdo \
    pdo_mysql \
    zip \
    # 多进程控制
    pcntl \
    # 进程间通信
    shmop \ 
    # 安装redis
    && pecl install /root/ext/redis-5.3.4.tgz && docker-php-ext-enable redis \
    # 安装xdebug
    && pecl install /root/ext/xdebug-3.0.4.tar.gz && docker-php-ext-enable xdebug
# 设置阿里云composer
RUN composer config -g repo.packagist composer https://mirrors.aliyun.com/composer/
RUN rm -rf /var/www
COPY ./conf/ /usr/local/etc/
EXPOSE 9000
WORKDIR /var/www